package com.project.bean;


import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import java.util.List;

/**
 * 用户实体类
 */
public class UserBean {
    /**用户编号*/
    private int id;
    /**用户名*/
    @NotBlank(message = "用户名必须填写")
    private String code;
    /**用户密码*/
    private String psw = "111";
    /**真实姓名*/
    @NotBlank(message = "真实姓名必须填写")
    @Pattern(regexp = "[a-zA-Z\\u4e00-\\u9fa5]{2,}",message = "姓名必须是2位以上的汉字或字母")
    private String realName;
    /**角色集合*/
    private List<RoleBean> roleList;

    public UserBean(String code, String realName) {
        this.code = code;
        this.realName = realName;
    }

    public UserBean() {
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getPsw() {
        return psw;
    }

    public void setPsw(String psw) {
        this.psw = psw;
    }

    public String getRealName() {
        return realName;
    }

    public void setRealName(String realName) {
        this.realName = realName;
    }

    public List<RoleBean> getRoleList() {
        return roleList;
    }

    public void setRoleList(List<RoleBean> roleList) {
        this.roleList = roleList;
    }

    @Override
    public String toString() {
        return "UserBean{" +
                "id=" + id +
                ", code='" + code + '\'' +
                ", psw='" + psw + '\'' +
                ", realName='" + realName + '\'' +
                ", roleList=" + roleList +
                '}';
    }
}
